
library(testthat)
library(blma)
library(tictoc)
library(parallel)

cores <- detectCores()

test_that('comCrime produces correct results liang_g_n_quad', {
	set.seed(2019)
    comCrime <- get_comCrime()
    vy <- comCrime$vy
    mX <- comCrime$mX
    tic('comCrime produces correct results liang_g_n_quad')
    result <- sampler(100000, vy, mX, prior='liang_g_n_quad', modelprior='uniform', cores=cores)
    toc()
    expect_equal(result$vinclusion_prob, 
c(
0.9547500000000000,0.8645200000000000,0.2978900000000000,0.8612300000000001,
0.2703900000000000,0.6538100000000000,0.2420400000000000,0.4038500000000000,
0.2664800000000000,0.5470400000000000,0.4669400000000000,0.4362700000000000,
0.2494800000000000,0.2860500000000000,0.1656900000000000,0.1783700000000000,
0.2526200000000000,0.2333100000000000,0.3664700000000000,0.2129700000000000,
0.3644300000000000,0.3046700000000000,0.3824700000000000,0.2644800000000000,
0.2468800000000000,0.1990200000000000,0.2754100000000000,0.2146500000000000,
0.5100000000000000,0.2702800000000000,0.5911200000000000,0.2067600000000000,
0.2046500000000000,0.2507900000000000,0.3814400000000000,0.2163000000000000,
0.2318200000000000,0.2339300000000000,0.2166400000000000,0.8040000000000000,
0.3374100000000000,0.2373900000000000,0.3902400000000000,0.6205900000000000,
0.3077600000000000,0.5002600000000000,0.1910600000000000,0.1965700000000000,
0.8591100000000000,0.9672400000000000,0.9636900000000000,0.1886000000000000,
0.2591600000000000,0.2985600000000000,0.6283800000000000,0.2130700000000000,
0.2942200000000000,0.2571800000000000,0.2348800000000000,0.3375400000000000,
0.2208100000000000,0.4040000000000000,0.3101700000000000,0.3710000000000000,
0.4411800000000000,0.3922900000000000,0.4137700000000000,0.7348600000000000,
0.2431500000000000,0.1677400000000000,0.9396099999999999,0.2877300000000000,
0.3959600000000000,0.1909800000000000,0.2730300000000000,0.1890800000000000,
0.2532200000000000,0.3960300000000000,0.4130300000000000,0.3155900000000000,
0.3434800000000000,0.2052500000000000,0.2311600000000000,0.5709600000000000,
0.3740500000000000,0.1726400000000000,0.7559200000000000,0.2187300000000000,
0.3920100000000000,0.6177200000000000,0.1883800000000000,0.2105400000000000,
0.8637899999999999,0.2442100000000000,0.2182500000000000,0.1793900000000000,
0.1693700000000000,0.1690400000000000,0.9499600000000000
)
, tolerance = 1e-5)
})